package com.igoal.dao;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.igoal.entity.DataStatus;
import com.igoal.entity.ProfileComplete;

@Repository("profileCompleteDAO")
public class ProfileCompleteDAOImpl extends GenericDaoHibernate<ProfileComplete, Long> implements
		ProfileCompleteDAO {

	public ProfileCompleteDAOImpl() {
		super(ProfileComplete.class);
	}

	public ProfileComplete findByPK(Long id) {
		DetachedCriteria dc = DetachedCriteria.forClass(ProfileComplete.class);
		dc.add(Restrictions.eq("id", id));
		getByStatus(dc, DataStatus.USING);

		List<ProfileComplete> result = findByCriteria(dc);
		if (result != null && result.size() > 0) {
			return result.get(0);
		}

		return null;
	}

}
